﻿#pragma once
#include <vector>

#include <osg/Vec3d>
#include <osg/Array>

void appendPoints(osg::Vec3Array* va, const std::vector<osg::Vec3d>& points);

// 计算sin(A + n * PI/180)
double sinValue(double sinA, double cosA, int n/*degree*/);
// 计算cos(A + n * PI/180)
double cosValue(double sinA, double cosA, int n/*degree*/);
void ArbitraryAxis(const osg::Vec3d & zAxis, osg::Vec3d & xAxis, osg::Vec3d & yAxis);

// assert(n > 0 && (360 % n == 0));
std::vector<osg::Vec3d> getCirclePoints(const osg::Vec3d & center, const osg::Vec3d & axis, double radius, int n/*count of points*/);
std::vector<osg::Vec3d> getArcPoints(const double& startAngle, const double& endAngle,
	const double& radius, const osg::Vec3d& center, const osg::Vec3d & axis, int step/*degree*/);
std::vector<osg::Vec3d> getDiskTriangles(const osg::Vec3d& center, const std::vector<osg::Vec3d>& circlePoints, bool reverse = false);
std::vector<osg::Vec3d> getCirqueTriangles(const std::vector<osg::Vec3d>& outer, const std::vector<osg::Vec3d>& inner, bool reverse = false);
std::vector<osg::Vec3d> getCylinderSideTriangles(const std::vector<osg::Vec3d>& bottomPoints, const std::vector<osg::Vec3d>& topPoints);
inline std::vector<osg::Vec3d> getConeSideTriangles(const osg::Vec3d& otherCenter, const std::vector<osg::Vec3d>& circlePoints, bool reverse = false)
{
	return getDiskTriangles(otherCenter, circlePoints, reverse);
}

